##------------------------------------------------------------------------------
##
##	yasco-1.0 - Yet Another (Java)Script Obfuscator
##	Copyright (C) 2008-2011 Oliver Schieche <schieche\@alfahosting.de>
##
##	Makes use of Yapp
##	Parse::Yapp - Copyright (c) 1998-2001, Francois Desarmenien, all right reserved.
##
##	$Id$
##------------------------------------------------------------------------------
package Yasco::Runner;

use strict;
use warnings;
use constant RC_FILE => '.yasco_rc';

use Config::General;
use Yasco::CommandLine;
##------------------------------------------------------------------------------
sub run
	{
		chomp(my $cwd = `pwd`);
		my $cfg_file = $cwd . '/' . RC_FILE;

		READ_RCFILE: {

			last READ_RCFILE unless -f $cfg_file;

			my $co = new Config::General($cfg_file);
			my %cfg = $co->getall();
			my @args;

			last READ_RCFILE unless exists $cfg{CommandLine};

			while (my ($k,$v) = each(%{$cfg{CommandLine}}))
				{
					push(@args, $k), next unless defined($v);
					push(@args, $k, $v), next unless ref $v;
					push @args, map {($k,$_)} @$v;
				}

			@ARGV = (@args, @ARGV);
		}

		Yasco::CommandLine->run;
	}
##------------------------------------------------------------------------------
1